<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改审核课题')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-teachecktask-edit" th:object="${sysTaskStu}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label">课题名称：</label>
                <div class="col-sm-8">
                    <input name="taskName" th:field="*{taskName}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">课题来源：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('sys_task_come')}">
                        <input name="taskCome" th:field="*{taskCome}" th:id="${dict.dictCode}"
                               th:value="${dict.dictValue}" type="radio">
                        <label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">课题类型：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('sys_task_type')}">
                        <input name="taskType" th:field="*{taskType}" th:id="${dict.dictCode}"
                               th:value="${dict.dictValue}" type="radio">
                        <label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">课题背景：</label>
                <div class="col-sm-8">
                    <textarea name="taskBackground" class="form-control">[[*{taskBackground}]]</textarea>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">设计说明：</label>
                <div class="col-sm-8">
                    <textarea name="taskDesign" class="form-control">[[*{taskDesign}]]</textarea>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">课题技术：</label>
                <div class="col-sm-8">
                    <textarea name="taskTech" class="form-control">[[*{taskTech}]]</textarea>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">实践环节类型：</label>
                    <div class="col-sm-8">
                        <input name="taskName" th:field="*{taskClass}" class="form-control" type="text">
                    </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">姓名：</label>
                <div class="col-sm-8">
                    <input name="stuName" th:field="*{stuName}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">审核状态：</label>
                <div class="col-sm-6">
                    <button type="button" class="btn btn-primary btn-rounded btn-sm" onclick="pass()">通过</button>
                    <button type="button" class="btn btn-warning btn-rounded btn-sm" onclick="alter()">修改</button>
                    <button type="button" class="btn btn-danger btn-rounded btn-sm" onclick="down()">驳回</button>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">修改意见：</label>
                <div class="col-sm-8">
                    <textarea name="taskIdea" class="form-control">[[*{taskIdea}]]</textarea>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "system/teachecktask";
        var id = [[${sysTaskStu.id}]]
        $("#form-teachecktask-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-teachecktask-edit').serialize());
            }
        }
        function pass() {
            $.modal.confirm('确认修改当前课题状态？',function(){
                var config = {
                    type: "post",
                    url: "/system/teachecktask/editid1",
                    dataType: "json",
                    data:{
                        id:id
                    },
                    beforeSend: function () {
                        $.modal.loading("正在处理中，请稍后...");
                    },
                    success: function (result) {

                        if (result.msg == "操作失败") {
                            $.modal.alertWarning("修改失败");
                        }
                        else{
                            $.modal.alertSuccess(result.msg);
                        }
                        $.modal.closeLoading();
                    }
                };
                $.ajax(config);
            });
        }
        function alter() {
            $.modal.confirm('确认修改当前课题状态？',function(){
                var config = {
                    type: "post",
                    url: "/system/teachecktask/editid2",
                    dataType: "json",
                    data:{
                        id:id
                    },
                    beforeSend: function () {
                        $.modal.loading("正在处理中，请稍后...");
                    },
                    success: function (result) {

                        if (result.msg == "操作失败") {
                            $.modal.alertWarning("修改失败");
                        }
                        else{
                            $.modal.alertSuccess(result.msg);
                        }
                        $.modal.closeLoading();
                    }
                };
                $.ajax(config);
            });
        }
        function down() {
            $.modal.confirm('确认修改当前课题状态？',function(){
                var config = {
                    type: "post",
                    url: "/system/teachecktask/editid3",
                    dataType: "json",
                    data:{
                        id:id
                    },
                    beforeSend: function () {
                        $.modal.loading("正在处理中，请稍后...");
                    },
                    success: function (result) {

                        if (result.msg == "操作失败") {
                            $.modal.alertWarning("修改失败");
                        }
                        else{
                            $.modal.alertSuccess(result.msg);
                        }
                        $.modal.closeLoading();
                    }
                };
                $.ajax(config);
            });
        }
    </script>
</body>
</html>